<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		 <!--[if lt IE 9]>
    <script src="../js/jquery-1.11.3.js"></script>
    
<![endif]-->
<!--[if gte IE 9]><!-->
    <script src="../js/jquery-3.1.1.js"></script>
<!--<![endif]-->
<script>
$(document).ready(function(){
  $("#input1").keydown(function(){
    $("input").css("background-color","yellow");
  });
  $("#input1").keyup(function(){
    $("input").css("background-color","pink");
  });
   $("#input2").keypress(function(){
    $("span").text(i+=1);
  });
});

i=0;
</script>
	</head>
	<body>

输入你的名字: <input id ="input1"  type="text">
<p>在以上输入框中输入你的名字。在按键按下后输入框背景颜色会改变。</p>
<input id ="input2" type="text">
<p>按键的次数: <span>0</span></p>
	</body>
</html>
